class Mind::MindController < ApplicationController
  layout 'mind'
  before_filter :login_required

  def visionlist  
   if request.xhr?
      @pagination_opts = { :prev_label   => '&laquo; ',
                           :next_label   => ' &raquo;',
                           :inner_window => 3, 
                           :outer_window => 1 }
      @cond = "public = 1"        
      if logged_in?
        @cond = "friend_id = #{current_friend.id}" unless current_friend.in_domain? :admin
      end
      @visions = Vision.list params[:vpage], @cond
      render :partial => "common/visiontoolview"
    end
  end

  def mindlist  
    @pagination_opts = { :prev_label   => '&laquo; ',
                         :next_label   => ' &raquo;',
                         :inner_window => 3, 
                         :outer_window => 1 }
    @cond = "friend_id = #{params[:id]}"
    @pages = Page.list params[:page], @cond
    redirect_to :controller => 'friends', :action => 'list' if @pages.empty? 
    @page = @pages.first
  end

end